﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AutoLoL.Dialogs
{
    /// <summary>
    /// Interaction logic for ExceptionDialog.xaml
    /// </summary>
    public partial class ExceptionDialog : Window
    {
        public ExceptionDialog(Exception exception)
        {
            InitializeComponent();

            ExceptionTextBox.Text = "************** Error Report **************";
            ExceptionTextBox.Text += Environment.NewLine;
            ExceptionTextBox.Text += exception.ToString();

            UpdateButton.Focus();
            CloseButton.IsCancel = true;
        }

        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
            e.Handled = true;
        }

        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            MainWindow.UpdateUpdater();
            Process.Start("AutoLoL.Updater.exe");
            Close();
        }
    }
}
